package com.kanche.bigbaby.collection.ui;

import android.graphics.drawable.Drawable;

import com.kanche.bigbaby.collection.StringUtils;

//import com.kkche.bss.utils.StringUtils;

/**
 * Created by nealmi on 6/20/14.
 */
public class KVItem {
    private String label;
    private int labelResourceId;
    private String value;
    private int iconResourceId = 0;
    private String awesomeIcon;
    private Drawable iconDrawable;

    public KVItem() {
    }

    private KVItem(String label, String value) {
        this.label = label;
        this.value = value;
    }

    private KVItem(int labelResourceId, String value) {
        this.labelResourceId = labelResourceId;
        this.value = value;
    }

    public static KVItem create(int labelResourceId, String value) {
        return new KVItem(labelResourceId, value);
    }

    public static KVItem create(String label, String value) {
        return new KVItem(label, value);
    }

    public static KVItem create(int iconResourceId, int backgroundResourceId) {
        KVItem kvItem = new KVItem();
        kvItem.setIconResourceId(iconResourceId);
        kvItem.setValue(String.valueOf(backgroundResourceId));
        return kvItem;
    }

    public String getAwesomeIcon() {
        return awesomeIcon;
    }

    public void setAwesomeIcon(String awesomeIcon) {
        this.awesomeIcon = awesomeIcon;
    }

    public KVItem icon(int iconResourceId) {
        setIconResourceId(iconResourceId);
        return this;
    }

    public KVItem icon(Drawable drawable) {
        setIconDrawable(drawable);
        return this;
    }

    public KVItem icon(String awesomeIcon) {
        setAwesomeIcon(awesomeIcon);
        return this;
    }

    public Drawable getIconDrawable() {
        return iconDrawable;
    }

    public void setIconDrawable(Drawable iconDrawable) {
        this.iconDrawable = iconDrawable;
    }

    public int getIconResourceId() {
        return iconResourceId;
    }

    public void setIconResourceId(int iconResourceId) {
        this.iconResourceId = iconResourceId;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public boolean hasIconResourceId() {
        return iconResourceId != 0;
    }

    public boolean hasAwesomeIcon() {
        return StringUtils.hasText(awesomeIcon);
    }

    public boolean hasIconDrawable() {
        return iconDrawable != null;
    }

    public boolean hasValue() {
        return value != null;
    }

    public int getLabelResourceId() {
        return labelResourceId;
    }

    public void setLabelResourceId(int labelResourceId) {
        this.labelResourceId = labelResourceId;
    }
}
